﻿using Super_Management_Mayhem.Content.Spritesheet;
using Transformable_Engine_v2.Engine.GameObjects.Containers;
using Transformable_Engine_v2.Engine.GameObjects.Containers.Transformable_controls;
using Transformable_Engine_v2.Engine.Transformable_Math.Geometry;

namespace Super_Management_Mayhem.Screens.Menu.SelectAvatar
{
    public class EmployeeCard : Container
    {
        public EmployeeCard()
            : this(new ProfileData {
                                       Color = -1,
                                       GamesPlayed = -1,
                                       Icon = -1,
                                       Level = -1,
                                       Name = "????????????"
                                   }) {}

        public EmployeeCard(ProfileData profileData)
        {
            AddChildren(new ImageContainer {
                                               Sprite = MenuSheet.GetSprite(MenuSheet.Menu.ProfileCard),
                                               Scale = new TE_Vector2(2, 2)
                                           });

            if(profileData.Icon != -1)
            {
                AddChildren(new ImageContainer {
                                                   Position = new TE_Vector2(47, 75),
                                                   Sprite = ProfileIconSheet.GetSprite((ProfileIconSheet.Icon) profileData.Icon),
                                                   Origin = TE_Rectangle.Alignment.CenterMiddle,
                                                   Scale = new TE_Vector2(2, 2)
                                               });
            }

            AddChildren(new Label(MenuSheet.GetInstance().GetSpriteAlphabet<MenuSheet.LetterAlphabet>, profileData.Name) {
                                                                                                                 Position = new TE_Vector2(142, 44)
                                                                                                             });

            if(profileData.Level == -1)
            {
                AddChildren(new Label(MenuSheet.GetInstance().GetSpriteAlphabet<MenuSheet.LetterAlphabet>, "?") {
                                                                                                                                 Position = new TE_Vector2(218, 68),
                                                                                                                                 TextAlign = TE_Rectangle.Alignment.TopMiddle
                                                                                                                             });
            }
            else
            {
                AddChildren(new Label(MenuSheet.GetInstance().GetSpriteAlphabet<MenuSheet.LetterAlphabet>, profileData.Level.ToString()) {
                                                                                                                                 Position = new TE_Vector2(218, 68),
                                                                                                                                 TextAlign = TE_Rectangle.Alignment.TopMiddle
                                                                                                                             });
            }

            
        }
    }
}
